package util;


//stands for a type (class or simple type)
public class CType {
	public static final CType BOOL = new CType("boolean");
	public static final CType LONG = new CType("long");
	public static final CType INT = new CType("int");
	public static final CType VOID = new CType("void");
	public static final CType INT_ARRAY = new CType("int[]");
	public static final CType LONG_ARRAY = new CType("long[]");
	public String _name;
	public CType(String name) {
		_name = name;
	}
//	public void setName(String name) {
//		_name = name;
//	}
	public boolean isArray(){
		if(_name.equals("int[]") || _name.equals("long[]") )
			return true;
		return false;
	}
	public CType correspondingTypeOfArray(){
		assert (isArray());
		CType newType = new CType("");
		if(_name.equals("int[]"))	newType._name = "int";
		if(_name.equals("long[]"))	newType._name = "long";
		return newType;
	}
	public boolean equals(Object o) {
		CType other = (CType) o;
		if (other==null)
			return false;
		else return _name.equals(other._name);
	}
	public String toString() {
		return _name;
	}
}
